package com.lj.ljminsu.merchant.GuanjiaService.impl;
import com.lj.ljminsu.merchant.GuanjiaBean.OderUtil;
import com.lj.ljminsu.merchant.GuanjiaBean.Oderxq;
import com.lj.ljminsu.merchant.GuanjiaBean.PageUtil;
import com.lj.ljminsu.merchant.GuanjiaBean.TjOrder;
import com.lj.ljminsu.merchant.Dao.OderListDao;
import com.lj.ljminsu.merchant.GuanjiaService.IoderService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
@Service
public class OderService implements IoderService {
    private final  Integer pageSize=3;
    @Resource
    private OderListDao oderListDao;
    @Override
    public List<TjOrder> serch(OderUtil oderUtil) {
        return oderListDao.serch(oderUtil);
    }

    @Override
    public Oderxq findOderXq(Integer oderId) {
        return oderListDao.findOderXq(oderId);
    }

    @Override
    public Integer DelateByoId(Integer oderId) {
        return oderListDao.DelateByoId(oderId);
    }

    @Override
    public Integer QueRen(Integer oderId, Integer sta) {
        return oderListDao.QueRen(oderId ,sta);
    }

    @Override
    public PageUtil QueueTotalPage(Integer danq) {
        Integer cont = oderListDao.FindCont();
        Integer totalPage=0;
        if (cont%pageSize==0){
            totalPage=cont/pageSize;
        }else {
            totalPage=cont/pageSize;
        }
        Integer begin=danq*pageSize;
        PageUtil pageUtil=new PageUtil();
        pageUtil.setTotalPage(totalPage);
        pageUtil.setPageNum(pageSize);
        pageUtil.setBegin(begin);
        return pageUtil;
    }

    @Override
    public List<TjOrder> Fenye(PageUtil pageUtil) {
        return oderListDao.Fenye(pageUtil);
    }
//    分页
}
